package com.spz.demo.singleboot.dao.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.spz.demo.singleboot.entity.system.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * mapper
 * @author spzmmd
 * @date 2019/05/15
 */
@Repository
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    /**
     * 设置父菜单标识
     * @param menuCode
     * @param parentCode
     * @return
     */
    @Update("UPDATE sys_menu SET " +
            "   parent_menu_code = #{parentCode}" +
            "WHERE " +
            "   valid = 1 " +
            "   AND code = #{menuCode}")
    int setParentCode(@Param("menuCode") String menuCode, @Param("parentCode") String parentCode);

}
